<?php

namespace App\Models\administration;

use App\Models\AdminModel;
use App\Models\StaffModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model as BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class MsgModel extends BaseModel
{
    use HasFactory, SoftDeletes;

    protected $table = 't_administration_msg';

    protected $primaryKey = 'id';

    public $timestamps = true;

    const CREATED_AT = 'created_at';
    
    const UPDATED_AT = null;

    const TYPE = [1 => '员工转正', 2 => '员工生日', 3 => '合同期满'];

    const STATUS = [0 => '未读', 1 => '已读'];

    protected $guarded = [];

    protected $hidden = [
        'deleted_at',
    ];


    //创建人
    public function create_admin(): BelongsTo {
        return $this->belongsTo(AdminModel::class, 'created_admin_id');
    }

    public function staff(): BelongsTo {
        return $this->belongsTo(StaffModel::class, 'staff_id');
    }

}
